package v1

import (
	"caas-platform-payment/internal/model/entity"

	"github.com/gogf/gf/v2/frame/g"
)

type ListReq struct {
	g.Meta      `path:"/channels" tags:"支付渠道管理" method:"get" summary:"租户支付渠道列表"`
	TenantCode  string `json:"tenantCode" description:"租户编码"`
	ChannelName string `json:"channelName"       description:"通道名称"`
	AppId       string `json:"appId"             description:"应用ID"`
	MerchantId  string `json:"merchantId"        description:"商户ID"`
	Page        int    `json:"page"   v:"required|min:1"     description:"页码"`
	Size        int    `json:"size" v:"required|between:1,100"       description:"每页条数"`
}
type ListRes struct {
	g.Meta `mime:"application/json"`
	Data   []entity.PayChannel `json:"data"`
	Total  int                 `json:"total"`
}

type AddReq struct {
	g.Meta                   `path:"/channels" tags:"支付渠道管理" method:"post" summary:"添加支付渠道"`
	TenantCode               string `json:"tenantCode"   v:"required"                description:"租户编码"`
	AppId                    string `json:"appId"         v:"required"                      description:"应用ID"`
	ChannelName              string `json:"channelName"     v:"required"                   description:"支付渠道"`
	MerchantId               string `json:"merchantId"         v:"required"                  description:"商户ID"`
	MerchantCertSerialNumber string `json:"merchantCertSerialNumber" description:"商户证书序列号"`
	MerchantApiKey           string `json:"merchantApiKey"                 description:"商户API密钥用于加密敏感信息"`
	PublicKey                string `json:"publicKey"         v:"required"                 description:"商户API证书/公钥"`
	PrivateKey               string `json:"privateKey"          v:"required"           description:"商户API私钥"`
}
type AddRes struct {
	g.Meta `mime:"application/json"`
	Id     int64 `json:"id"`
}

type DeleteReq struct {
	g.Meta `path:"/channels/{id}" tags:"支付渠道管理" method:"delete" summary:"删除支付渠道"`
	Id     int64 `query:"id" v:"required|min:1"`
}
type DeleteRes struct {
	g.Meta `mime:"application/json"`
	Rows   int64 `json:"rows" description:"删除成功的行数"`
}

type UpdateReq struct {
	g.Meta                   `path:"/channels/{id}" tags:"支付渠道管理" method:"put" summary:"更新支付渠道"`
	Id                       int64  `query:"id" v:"required|min:1"`
	TenantCode               string `json:"tenantCode"                      description:"租户编码"`
	AppId                    string `json:"appId"                              description:"应用ID"`
	ChannelName              string `json:"channelName"                       description:"支付渠道"`
	MerchantId               string `json:"merchantId"                       description:"商户ID"`
	MerchantCertSerialNumber string `json:"merchantCertSerialNumber"  description:"商户证书序列号"`
	MerchantApiKey           string `json:"merchantApiKey"                 description:"商户API密钥用于加密敏感信息"`
	PublicKey                string `json:"publicKey"                  description:"商户API证书/公钥"`
	PrivateKey               string `json:"privateKey"                    description:"商户API私钥"`
}
type UpdateRes struct {
	g.Meta `mime:"application/json"`
	Rows   int64 `json:"rows" description:"删除成功的行数"`
}
